﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo9
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // 满减 99减2 199减10   299减50  满399减80
            var price = Convert.ToDecimal(Console.ReadLine());
            decimal discount = 0M;
            Console.WriteLine("用户购物车结算的原价为{0:c2}", price);

            switch (price)
            {
                // 模式匹配  a名称用户自定义
                // 为price定义一个模式n(名称任选，类型一致), when对模式进行限定（逻辑或关系表达式）
                case decimal m when m >399:
                    discount = 80M;
                    break;
                case decimal t when t >299:
                    discount = 50M;
                    break;
                case decimal n when n >199:
                    discount =10M;
                    break;
                case decimal n when n>99:
                    discount = 2M;
                    break;
                default:
                    break;
            }
            Console.WriteLine("购物车的总价为{0:c2}，折扣{1:c2}，应付{2:c2}", price, discount, price - discount);
            Console.ReadKey();
        }
    }
}
